<?php get_instance()->view('common/header');?>
<style>
    .weui-cells_checkbox .weui-icon-checked:before{
        background: url(<?php echo $this->staticUrl?>/img/png/pic30.png) no-repeat;
        background-size: cover;
    }
    .weui-check__label:active{
        background-color: transparent;
    }
</style>
<body class="bagimg">
<div class="wp80 m0a">
    <img class="wp100 pos" style="left: 0;top:0;z-index: -1;" src="<?php echo $this->staticUrl?>/img/png/zzz1.png" alt="">
    <img class="wp100 pos" style="left: 0;bottom:0; z-index: -1;" src="<?php echo $this->staticUrl?>/img/png/zzz2.png" alt="">
    <div class="logininput">
        <img src="<?php echo $this->staticUrl?>img/png/pic78.png" class="heightimg" alt="">
        <input name="mobile" type="text" placeholder="请输入手机号" class="f09">
        <a href="javascript:;" class="szzz f08 dk sendyzm">获取验证码</a>
    </div>
    <div class="logininput mb20">
        <img src="<?php echo $this->staticUrl?>img/png/pic77.png" class="heightimg" alt="">
        <input name="code" type="text" placeholder="请输入手机验证码" class="f09">
    </div>
    <button class="kbtn">下一步</button>

</div>
<div class="weui-cells_checkbox wp100" style="background: transparent;position: absolute;bottom: 2em;left: 0;">
    <div class="wp80 m0a">
        <label class="weui-cell weui-check__label p0" for="s12">
            <div class="weui-cell__hd f10">
                <input type="checkbox" name="checkbox1" class="weui-check" id="s12" checked>
                <i class="weui-icon-checked mbmin"></i>
            </div>
            <div class="weui-cell__bd vCenter">
                <p class="f08 cor3">我已阅读并同意<a class="lanzi fb" href="<?php echo getUrl('common/agreement')?>">《戈壁市集用户注册协议》</a></p>
            </div>
        </label>
    </div>
</div>
</body>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script type="text/javascript">
    $(function () {
        $.e_validate.init('#save-form',{saveMessage:'保存中...'});
    })
</script>
<script>

    $(function(){

        $('.sendyzm').click(function(){
            var phone = $('[name="mobile"]').val();
            if(phone == ""){
                show_message({status:0, message:'请输入手机号码'});
                return false;
            }
            var reg = /^0?1[3|4|5|7|8|9][0-9]\d{8}$/;
            if (!(reg.test(phone))) {
                show_message({status:0, message:'请输入正确的手机号码'});
                return false;
            }

            $.ajax({
                url: '<?php echo getUrl("user/getRegisterVerifyCode")?>',
                type:"POST",
                data:{
                    mobile:phone
                },

                success:function(arr){
                    if(arr.status == "1"){
                        tt = setInterval(time_show,1000);
                    }
                    show_message({status:arr.status, message:arr.message});

                    return false;
                },
                dataType:'json'
            });
        })
        $('.kbtn').on('touchstart', function(){
            var phone = $('[name="mobile"]').val();
            var code = $('[name="code"]').val();

            $.ajax({
                url: '<?php echo getUrl("user/checkVerifyCode")?>',
                type:"POST",
                data:{
                    mobile:phone,
                    code:code,
                },
                success:function(arr){
                    console.info(arr);
                    if(arr.status == "0"){
                        show_message({status:arr.status, message:arr.message});
                        return false;
                    }else {
                        window.location.href = arr.url;
                    }

                    return false;
                },
                dataType:'json'
            });
        })
    });

    var time=60;
    function time_show(){
        if(time>1){
            time=time-1;
            $(".sendyzm").text(time+'s');
            $('[name="mobile"]').attr("readonly",true);
        }else{
            $(".sendyzm").text('重新获取');
            $('[name="mobile"]').attr("readonly",false);
            $('.sendyzm').attr('disabled',false);
            clearInterval(tt);
            time=60;
        }

    }
</script>
</html>